home *** CD-ROM | disk | FTP | other *** search
-
- Under GEMDOS, everything you see in a floppy's directory, and
- a few other things, are gathered together into one single list of
- names. Attached to each name in the list is an attribute byte that
- identifies what the item is for. The average directory list will
- contain folders, volume labels, hidden files, system files, read-
- only files, and, of course, normal files. Lock & Key works by
- changing the attribute of a folder so that GEMDOS thinks the name
- belongs to a hidden file, thus hiding the folder from view or use.
-
- When I first set out to write the key program, I thought it
- would be a breeze. I had expected to be able to use the GEMDOS
- function CHMOD, or Change Mode, to simply change the attribute of
- the folder in question to 'hidden' status. But alas, any reference
- to any folder with the CHMOD function generates an error. To get
- around this problem, I found it was necessary to directly modify
- the root directory of the disk. This required reading in several
- sectors, finding the correct directory entry, changing the
- attribute byte, (I'm not saying where that byte is, evil-doers)
- and then writing the sectors back to the disk. Now add to that the
- burden of performing complex pattern matching, unscrambling the
- foldername and password, and working entirely in assembly. So much
- for an easy program.
-
- Since I had never worked in assembly on the ST before, and
- since I had no idea what the standard conventions and procedures
- were for passing parameters among functions, I made it all up.
- Some of you, upon examining the source code for the key, may find
- my assembly language style atrocious, but try to remember my lack
- of experience.
-
- The other program, the installer, was probably easier to
- write than the key program, although it still took the longest to
- finish. Since I needed to get some information from the user
- requiring the keyboard, and since the file selector box was not
- really practical, I decided it was time to write a self-contained
- dialog box function, requiring no resource file, that would be
- similar to the alert box yet allow input of a single line of text.
- The function I eventually wrote, called simply dialog(), is
- extremely useful anytime you want to get some kind of text from
- the user. The function allows up to four lines of output text, one
- line of input text and one or two buttons. It also allows you to
- use the default setting of your choice. The function will also
- adjust itself for height and width, depending on how much text you
- have to output.
-
- To make a key, the installer program will read in the file
- LOCKKEY.DAT, which is actually a program file that has been
- renamed. Next, the foldername and password are inserted in
- scrambled form, and then the file is written to the disk as
- KEY.TOS. If there is already a key present on the disk, you are
- given a chance to cancel the installation process. The rest of the
- program is general error checking and alert boxes.
-
-